import 'package:flutter/foundation.dart';

class OpenMediaBean {
  ///打开媒体的类型
  ///* Camera 只打开相机
  ///* Gallery 只打开相册
  ///* All 相册和相机
  String mediaType;

  ///是否打位置水印
  bool addressWatermark;

  ///是否使用native的loadingDialog
  bool useNativeLoadingDialog;

  ///可以选择的最大张数
  int maxSelectable;

  ///只打开相机
  OpenMediaBean.openCamera({
    this.addressWatermark = false,
    this.useNativeLoadingDialog = true,
  }) {
    this.mediaType = "Camera";
  }

  ///只打开相册
  OpenMediaBean.openGallery({
    @required this.maxSelectable,
    this.addressWatermark = false,
    this.useNativeLoadingDialog = true,
  }) {
    this.mediaType = "Gallery";
  }

  ///选择打开相机或这相册
  OpenMediaBean.openAll({
    this.maxSelectable = 1,
    this.addressWatermark = false,
    this.useNativeLoadingDialog = true,
  }) {
    this.mediaType = "All";
  }

  OpenMediaBean.fromJson(Map<String, dynamic> json) {
    this.mediaType = json['mediaType'];
    this.addressWatermark = json['addressWatermark'];
    this.useNativeLoadingDialog = json['useNativeLoadingDialog'];
    this.maxSelectable = json['maxSelectable'];
  }

  Map<String, dynamic> toJson() {
    final Map<String, dynamic> data = new Map<String, dynamic>();
    data['mediaType'] = this.mediaType;
    data['addressWatermark'] = this.addressWatermark;
    data['useNativeLoadingDialog'] = this.useNativeLoadingDialog;
    data['maxSelectable'] = this.maxSelectable;
    return data;
  }
}
